package com.android.bonn.fast.adapter;

import android.view.View;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class CellViewCreator<MODEL, VIEW extends CellView> {
    public abstract VIEW create(View itemView);

    public Class<MODEL> getModelClass() {
        ParameterizedType genericSuperclass = (ParameterizedType) getClass().getGenericSuperclass();
        Type type = genericSuperclass.getActualTypeArguments()[0];
        return (Class<MODEL>) (type instanceof Class ? type : ((ParameterizedType) type).getRawType());
    }

    public abstract CellViewType isCellViewType();

    public abstract int getItemViewId();

}